import { request } from '@/utils/request';

// 查询部门列表
export function listDept(query?: any) {
  return request.get({
    url: '/system/dept/list',
    params: query,
  });
}

// 查询部门列表（排除节点）
export function listDeptExcludeChild(deptId: string | number) {
  return request.get({
    url: '/system/dept/list/exclude/' + deptId,
  });
}

// 查询部门详细
export function getDept(deptId: string | number) {
  return request.get({
    url: '/system/dept/' + deptId,
  });
}

// 查询部门下拉树结构
export function treeselect() {
  return request.get({
    url: '/system/dept/treeSelect',
  });
}

// 根据角色ID查询部门树结构
export function roleDeptTreeselect(roleId: string | number) {
  return request.get({
    url: '/system/dept/roleDeptTreeSelect/' + roleId,
  });
}

// 新增部门
export function addDept(data: any) {
  return request.post({
    url: '/system/dept',
    data: data,
  });
}

// 修改部门
export function updateDept(data: any) {
  return request.put({
    url: '/system/dept',
    data: data,
  });
}

// 删除部门
export function delDept(deptId: string | number) {
  return request.delete({
    url: '/system/dept/' + deptId,
  });
}
